package base.conditionlock;

public class Consumer implements Runnable {
	
	LockedBuffer buffer;
	
	public Consumer(LockedBuffer buf) {
		buffer=buf;
	}
	
	public void run() {
		Object c=null;
		for(int i=0;i<20;i++){
			try {
				c=buffer.take();
			} catch (Exception e) {
				e.printStackTrace();
			}
			System.out.println("Consumed: "+c);
			try {
				Thread.sleep((int)(Math.random()*100));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		
	}

}
